<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<div class="box">
			<button data-action="remove">移除</button>
			<button data-action="new">新建</button>
			<button data-action="search">搜索</button>

			<script>
				var boxEl = document.querySelector('.box')

				boxEl.onclick = function (e) {
					var btnEl = e.target
					var action = btnEl.dataset.action

					switch (action) {
						case 'remove':
							console.log('移除')
							break
						case 'new':
							console.log('新建')
							break
						case 'search':
							console.log('搜索')
							break
					}
				}
			</script>
		</div>
	</body>
</html>
